<%@ page import="com.informet.ipd.modelo.dao.ProgEstrDao" %>
<%@ page import="com.informet.ipd.modelo.vo.UbigeoVO" %>
<%@ page import="com.informet.ipd.struts.form.ProgEstrForm" %>
<%@ page import="java.util.*" %>
<%@ page import="javax.swing.JOptionPane"%>

<%@ taglib uri="/tags/c" prefix="c"%>

<%
             //JOptionPane.showMessageDialog(null, "hello");

            StringBuffer cadenaSalida = new StringBuffer();
            List lista = null;


            ProgEstrDao supportFacade = new ProgEstrDao();
            ProgEstrForm form = new ProgEstrForm();

            try {

                String id = request.getParameter("id");
                //JOptionPane.showMessageDialog(null, "codigo departamento->"+id);
                //String id2 = request.getParameter("id2");
                String codTipCombo = request.getParameter("codTipCombo");
                //JOptionPane.showMessageDialog(null, "codigo codTipCombo->"+codTipCombo);
                UbigeoVO vo;


                
                   /*

                UbigeoVO vo;
                lista = supportFacade.getComboProvincia(id);
                form.setListProvincia(lista);

                cadenaSalida.append("<select  name='codProvincia' id='codProvincia' onchange='comboDistrito()' >");
                cadenaSalida.append(" <option value='-1'>[--Seleccionar Provinciaaaaaaaaaaaa--]</option>");

                Iterator it = lista.iterator();
                while (it.hasNext()) {
                    vo = (UbigeoVO) it.next();
                    if((vo.getNUM_CODPRV_PK().compareTo(id2))!=0)
                    {
                          cadenaSalida.append("<option value='"+vo.getNUM_CODPRV_PK()+"'>"+vo.getTX_NOMPRV()+"</option>");
                          //JOptionPane.showMessageDialog(null, "codprovdiferente"+vo.getNUM_CODPRV_PK()+vo.getTX_NOMPRV());
                    }
                    if(vo.getNUM_CODPRV_PK().compareTo(id2)==0){

                          cadenaSalida.append("<option selected value='"+vo.getNUM_CODPRV_PK()+"'>"+vo.getTX_NOMPRV()+"</option>");
                         //JOptionPane.showMessageDialog(null, "codprovigual"+vo.getNUM_CODPRV_PK()+vo.getTX_NOMPRV());
                    }

                }
                 cadenaSalida.append("</select>");
                 */




                if (codTipCombo.equals("llenarComboProvincia") )
                {
                  //  JOptionPane.showMessageDialog(null, id);
//JOptionPane.showMessageDialog(null, "hola ifcodtipocombo");
                        lista = supportFacade.getComboProvincia(id);
                        form.setListProvincia(lista);

                        //cadenaSalida.append("<table  width='100%' align='center' >");
                        cadenaSalida.append("   <tr> ");
                        cadenaSalida.append("       <td width='50%'align='right'>");
                        cadenaSalida.append("           Provinciareeeeeee &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;");
                        cadenaSalida.append("       </td>");
                        cadenaSalida.append("       <td >");


                        cadenaSalida.append("           <select  name='provincia' id='provincia' onchange='comboDistrito()' >");
                        cadenaSalida.append("               <option value='-1'>[--Seleccionar Provinciaaaaa--]</option>");
                          // JOptionPane.showMessageDialog(null, "id "+id);
                                                                Iterator it = lista.iterator();
                                                                while (it.hasNext()) {
                                                                        vo = (UbigeoVO) it.next();
                                                                        cadenaSalida.append("<option value='"+vo.getNUM_CODPRV_PK()+"'>"+vo.getTX_NOMPRV()+"</option>");
                                                                }
                        cadenaSalida.append("           </select>");

                        cadenaSalida.append("         </td>");
                        cadenaSalida.append("   </tr>");





                        //cadenaSalida.append("   </tr>");




                       // cadenaSalida.append("</div");
                }



            } catch (Exception e) {
                   cadenaSalida.append("error : "+e.toString());
            }
            out.print(cadenaSalida);
            //JOptionPane.showMessageDialog(null, "bye");
%>